package cn.hou.java.designpattern._11composite;

import java.util.ArrayList;
import java.util.List;

//目录: 字节点(还会有子节点)
public class Directory implements IFile {
	private String name;
	//子节点
	private List<IFile> list;

	public Directory(String name) {
		this.name = name;
		this.list = new ArrayList<IFile>();
	}
	@Override
	public void display() {
		System.out.println(name);
	}
	@Override
	public boolean add(IFile file) {
		return this.list.add(file);
	}
	@Override
	public boolean remover(IFile file) {
		return this.list.remove(file);
	}
	@Override
	public List<IFile> getChild() {
		return list;
	}

}
